/**
 * 
 */
package com.eagle.coders.security.transaction.beans;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Embeddable;

@Embeddable
public class TransactionLimitPK implements Serializable{
    
	private static final long serialVersionUID = 1L;

	private String transCode;
    
    private String groupCode;
    
    private Integer groupLevel;
    
    private String moduleCode;
    
    private String currencyCode;
    
    public TransactionLimitPK(){
        
    }
    
    public TransactionLimitPK(String groupCode, Integer groupLevel, 
                                String moduleCode, String currencyCode, String transCode){
        
        this.groupCode = groupCode;
        this.moduleCode = moduleCode;
        this.groupLevel = groupLevel;
        this.currencyCode = currencyCode;
        this.transCode = transCode;
    }
    
    @Column(name="FCCD", nullable = false)
    public String getCurrencyCode() {
        return currencyCode;
    }

    public void setCurrencyCode(String currencyCode) {
        this.currencyCode = currencyCode;
    }
    
    @Column(name="GRP_CD", nullable = false)
    public String getGroupCode() {
        return groupCode;
    }

    public void setGroupCode(String groupCode) {
        this.groupCode = groupCode;
    }
    
    @Column(name="GRP_LVL", nullable = false)
    public Integer getGroupLevel() {
        return groupLevel;
    }

    public void setGroupLevel(Integer groupLevel) {
        this.groupLevel = groupLevel;
    }
    
    @Column(name="MOD_CD", nullable = false)
    public String getModuleCode() {
        return moduleCode;
    }

    public void setModuleCode(String moduleCode) {
        this.moduleCode = moduleCode;
    }
    
    @Column(name="TRN_CD", nullable = false)
    public String getTransCode() {
        return transCode;
    }

    public void setTransCode(String transCode) {
        this.transCode = transCode;
    }

    @Override
    public boolean equals(Object other) {
        boolean isEqual = false;
        if(other instanceof TransactionLimitPK){
            TransactionLimitPK otherTransLmtPK = (TransactionLimitPK)other;
            isEqual = otherTransLmtPK.groupCode.equals(groupCode) && 
                      otherTransLmtPK.groupLevel.equals(groupLevel) && 
                      otherTransLmtPK.moduleCode.equals(moduleCode) && 
                      otherTransLmtPK.currencyCode.equals(currencyCode)&&
                      otherTransLmtPK.transCode.equals(transCode);
        }
        return isEqual;
    }

    @Override
    public int hashCode() {
        int hashCode = 31 * (groupCode.hashCode() + groupLevel.hashCode() +
                            moduleCode.hashCode() + currencyCode.hashCode()+
                            transCode.hashCode());
        return hashCode;
    }
}
